package com.hualude.roadsign.controller;

import com.hualude.roadsign.dto.DTRequestDto;
import com.hualude.roadsign.dto.DTResponseDto;
import com.hualude.roadsign.dto.JsonMsgDto;
import com.hualude.roadsign.service.RoadLineFaultCheckService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by ding on 2017/8/14.
 */
@Controller
@RequestMapping("/rds_roadLineFaultCheck")
public class RoadLineFaultCheckController {
    @Resource
    private RoadLineFaultCheckService roadLineFaultCheckService;

    @RequestMapping(value = "/getRoadLineFaultCheck4DT")
    @ResponseBody
    public DTResponseDto getRoadLineFaultCheck4DT(DTRequestDto dtRequestDto, Integer actorId, Integer orgId) {
        DTResponseDto dtResponseDto = new DTResponseDto();
        try {
            dtResponseDto = roadLineFaultCheckService.getRoadLineFaultCheck4DT(dtRequestDto, actorId, orgId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dtResponseDto;
    }


    @RequestMapping(value = "/roadLineFaultAudit")
    @ResponseBody
    public JsonMsgDto roadLineFaultAudit(Integer isPass, String feedback, Integer faultId, Integer userId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadLineFaultCheckService.roadLineFaultAudit(isPass, feedback, faultId, userId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getRoadLineFaultCheckList4App")
    @ResponseBody
    public JsonMsgDto getRoadLineFaultCheckList4App(Integer orgId, String actorIds, Integer faultStatus, Integer count, Integer size) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadLineFaultCheckService.getRoadLineFaultCheckList4App(orgId, actorIds, faultStatus, count, size));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getRoadLineInfo2Fault")
    @ResponseBody
    public JsonMsgDto getRoadLineInfo2Fault(Integer roadLineId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadLineFaultCheckService.getRoadLineInfo2Fault(roadLineId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getRoadLineFaultInfo2Fault")
    @ResponseBody
    public JsonMsgDto getRoadLineFaultInfo2Fault(Integer roadLineId, Integer roadLineFaultId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadLineFaultCheckService.getRoadLineFaultInfo2Fault(roadLineId, roadLineFaultId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getRoadLineFaultReportList4App")
    @ResponseBody
    public JsonMsgDto getRoadLineFaultReportList4App(Integer orgId, String actorIds, Integer faultStatus, Integer count, Integer size)
            throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadLineFaultCheckService.getRoadLineFaultReportList4App(orgId, actorIds, faultStatus, count, size));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }
}
